package com.tanhua.model.vo;

import com.tanhua.model.mongo.RecommendUser;
import com.tanhua.model.mongo.UserLike;
import com.tanhua.model.mongo.Visitors;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class UsersVo implements Serializable {
    private Integer id;
    private Integer age;                //年龄
    private String avatar;              //头像
    private String nickname;            //昵称
    private String gender;              // 性别
    private String city;                //城市
    private String education;           //学历
    private Integer marriage;           //婚姻状态
    private Integer matchRate;          //匹配度
    private Boolean alreadyLove;        ///是否喜欢

    public static UsersVo init(UserLike userLike, VisitorsVo visitorsVo) {
        UsersVo vo = new UsersVo();
        if (userLike != null) {
            BeanUtils.copyProperties(userLike, vo);
            vo.setAlreadyLove(userLike.getIsLike());
        }
        if (visitorsVo != null) {
            BeanUtils.copyProperties(visitorsVo, vo);
            vo.setMatchRate(visitorsVo.getFateValue().intValue());
        }

        return vo;
    }

}
